package com.hethongviet.job.pages;

import com.hethongviet.job.AppMain;
import com.hethongviet.job.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class AccountActivity extends Activity
{
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		setContentView(R.layout.page_account);

		((TextView) findViewById(R.id.textAccountMemberName)).setText(AppMain._user.getMemberId());
		((TextView) findViewById(R.id.textAccountMemberId)).setText(AppMain._user.getMemberId());
		((TextView) findViewById(R.id.textAccountCompany)).setText(AppMain._user.getCompanyName());
		((TextView) findViewById(R.id.textAccount)).setText(AppMain._user.getUsername());

		((Button) findViewById(R.id.buttonSetting)).setOnClickListener(new OnClickListener() {
			public void onClick(View v)
			{
				Intent intent = new Intent(AccountActivity.this,
						UserSettingActivity.class);
				startActivity(intent);
			}
		});

		((Button) findViewById(R.id.buttonChangPass)).setOnClickListener(new OnClickListener() {
			public void onClick(View v)
			{
				if (AppMain._isSMSEnable)
				{
					AppMain.showAlert(AccountActivity.this,
							R.string.textMessageSMSAvailableChangePass, false);
				}
				else
				{
					Intent intent = new Intent(AccountActivity.this,
							ChangePasswordActivity.class);
					startActivity(intent);
				}
			}
		});
	}
}
